﻿

function selectall() {
    
	if (document.forms[0].allbox.checked == true){
		var i 
		for (i =0; i < document.forms[0].elements.length; i++){
			var e =  document.forms[0].elements[i];
			if (e.name != "allbox" && e.type == "checkbox"){
				e.checked = true;
			}
		}
	}
	
	if (document.forms[0].allbox.checked == false){
		var i 
		for (i =0; i < document.forms[0].elements.length; i++){
			var e =  document.forms[0].elements[i];
			if (e.name != "allbox" && e.type == "checkbox"){
				e.checked = false;
			}
		}
	}
}


function selectByObj(obj,objName) {
    if (obj.checked == true) {
        var i;
        var inp = document.getElementById(objName);
        var inputs = document.getElementById(objName).getElementsByTagName('input');
        for (i = 0; i < inputs.length; i++) {
            var e = inputs[i];
            if (e != obj && e.type == "checkbox") {
                e.checked = true;
            }
        }
    }

    if (obj.checked == false) {
        var i;
        var inputs = document.getElementById(objName).getElementsByTagName('input');
        for (i = 0; i < inputs.length; i++) {
            var e = inputs[i];
            if (e != obj && e.type == "checkbox") {
                e.checked = false;
            }
        }
    }
}